package com.apache.flow.core.manager;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.apache.core.orm.Page;
import com.apache.flow.core.dao.FlowDeployDao;
import com.apache.flow.core.entity.FlowDeploy;
import com.apache.flow.vo.FlowDeployvo;

@Service
@Transactional
public class FlowDeployManager {
	@Autowired
	private FlowDeployDao flowDeployDao;

	/**
	 * 
	 * @param flowDeployvo
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * <p>@description 分页查询方法
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-7-29 下午04:50:38
	 */
	@Transactional(readOnly = true)
	public Page<FlowDeployvo> getFlowDeployInfo(FlowDeployvo flowDeployvo, int pageNo, int pageSize) {
		return flowDeployDao.getFlowDeployInfo(flowDeployvo, pageNo, pageSize);
	}

	/**
	 * 
	 * @param flowDeploy
	 * @return
	 * <p>@description 添加或修改方法
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-7-29 下午04:51:00
	 */
	public String saveOrUpdate(FlowDeploy flowDeploy) {
		flowDeployDao.save(flowDeploy);
		return flowDeploy.getDbId();
	}

	/**
	 * 
	 * @param id
	 * @return
	 * <p>@description 根据Id查询发布对方法
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-7-29 下午04:51:15
	 */
	@Transactional(readOnly = true)
	public FlowDeploy getById(String id) {
		return flowDeployDao.get(id);
	}

	/**
	 * 
	 * @param flowDeploy
	 * <p>@description 删除发布对象方法
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-7-29 下午04:51:42
	 */
	public void delete(FlowDeploy flowDeploy) {
		flowDeployDao.delete(flowDeploy);
	}

	/**
	 * 
	 * @param subTaskId  taskId
	 * @param taskAssignee  当前经办人
	 * <p>@description 修改历史表中，经办人信息
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-7-29 下午03:58:33
	 */
	public void update(String subTaskId, String taskAssignee) {
		flowDeployDao.update(subTaskId, taskAssignee);
	}

	/**
	 * 
	 * @return
	 * <p>@description 综合查询待办任务
	 * <p>@version 1.0
	 * <p>@author lvcai
	 * <p>@update 2013-11-16 上午11:25:58
	 */
	@Transactional(readOnly = true)
	public Page<Object[]> findTasksByOptions(Map<String, String> map) {
		return flowDeployDao.findTasksByOptions(map);
	}

	/**
	 * description:  根据某个人查询当前人的历史任务
	 * @param map
	 * @return  
	 * @author xyc 
	 * @update 2015-4-14
	 */
	@Transactional(readOnly = true)
	public Page<Object[]> findHistTasksByOptions(Map<String, String> map) {
		return flowDeployDao.findHistTasksByOptions(map);
	}

}
